// Sweep
// by BARRAGAN <http://barraganstudio.com> 

#include <Servo.h> 
 
Servo myservo1;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
Servo myservo2; // create a second servo
int pos1 = 90;    // variable to store the servo position 
int pos2 = 90;
int inByte = 0;
 
void setup() 
{ 
  myservo1.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(6); 
  // start serial port at 9600 bps:
  Serial.begin(9600);
  // initialize servos
  myservo1.write(pos1);
  myservo2.write(pos2);
} 
 
 
void loop() 
{ 
  while(Serial.available() < 1) { }
  inByte = Serial.read();
  if (inByte == 0xFA) {
    while(Serial.available() < 2) { }
    pos1 = Serial.read();
    pos2 = Serial.read();
    myservo1.write(pos1);
    myservo2.write(pos2);
  } 
} 
